home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 43 / Amiga Format CD43 (1999)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-09].iso / -serious- / graphics / sfwjpg / bin / pwpext < prev    next >
Text File  |  1999-06-15  |  2KB  |  110 lines

  1. #!/bin/sh
  2.  
  3. #
  4. # pwpext
  5. #
  6. # Copyright (c) 1997-1999  Everett Lipman
  7. #
  8. # This program is free software; you can redistribute it and/or
  9. # modify it under the terms of the GNU General Public License
  10. # as published by the Free Software Foundation; either version 2
  11. # of the License, or (at your option) any later version.
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. # GNU General Public License for more details.
  16. # The GNU General Public License is available at
  17. #
  18. #    http://www.fsf.org/copyleft/gpl.html
  19. #
  20. # Alternatively, you can write to the 
  21. #
  22. #    Free Software Foundation, Inc.
  23. #    59 Temple Place - Suite 330
  24. #    Boston, MA  02111-1307, USA
  25. #
  26.  
  27. #
  28. # pwpext - shell script to extract .jpg files from a .pwp file
  29. #
  30. # usage:  pwpext filename
  31. #         where filename is the .pwp file
  32. #
  33. # NOTE: pwpjpg and jpegtran must be in your $PATH for this script to work.
  34. #
  35.  
  36. exit_func()
  37. {
  38. echo ""
  39. if [ "$1" = "1" ]
  40. then
  41.    echo "* pwpext aborted *"
  42. else
  43.    echo "*** pwpext finished ***"
  44. fi
  45. echo ""
  46. exit $1
  47. }
  48.  
  49. echo ""
  50. echo "*** pwpext starting ***"
  51. echo ""
  52.  
  53. if [ "$1" = "" ]
  54. then
  55.    echo "Please supply the name of your .pwp file:"
  56.     echo ""
  57.     echo "pwpext mypix.pwp"
  58.    exit_func 1
  59. fi
  60.  
  61. if [ -f $1 ]
  62. then
  63.     pwpname="$1"
  64. else
  65.     if [ -f "$1.pwp" ]
  66.     then
  67.         pwpname="$1.pwp"
  68.     else
  69.         if [ -f "$1.PWP" ]
  70.         then
  71.             pwpname="$1.PWP"
  72.         else
  73.             echo "$1: file not found"
  74.             exit_func 1
  75.         fi
  76.     fi
  77. fi
  78.  
  79. echo "Extracting pictures from $pwpname..."
  80.  
  81. #
  82. # extract flipped jpeg files from .pwp file and save filenames in $picnames
  83. #
  84.  
  85. picnames=`pwpjpg $pwpname`
  86. echo "Done."
  87. echo ""
  88.  
  89. echo "Flipping jpeg files..."
  90. echo ""
  91.  
  92. #
  93. # for each extracted file, flip image with jpegtran
  94. #
  95.  
  96. for i in $picnames
  97. do
  98.     echo "flipping $i..."
  99.     mv $i $i.tmp
  100.     jpegtran -flip vertical < $i.tmp > $i
  101.     rm -f $i.tmp
  102. done
  103.  
  104. echo "" 
  105. echo Done.
  106.  
  107. exit_func 0
  108.